<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function findNumberIn2D(matrix, target){
            if(matrix === null || matrix.length === 0){
                return false;
            }
            let row = 0
            let column = matrix[0].length-1;
            while(row<matrix.length && column>=0){
                if(matrix[row][column] === target){
                    return true;
                }
                else if(matrix[row][column]<target){
                    row++;
                }
                else{
                    column--;
                }
            }
            return false;
        }
    </script>
</body>
</html>